//管理员功能
module.exports = function(app) {
  return new Handler(app)
}

var Handler = function(app) {
  this.app = app
  Handler.app = app
  this.sessionService = this.app.get('sessionService')
}
var local = {}
var handler = Handler.prototype

//获取背包
handler.getBag = function(msg,session,next) {
	var uid = session.get("uid")
	if(!uid){
		next(null,{flag : false})
		return
	}
	this.app.rpc.db.bag.getBag(null,uid,function(flag,data){
		next(null,{flag : flag,data : data})
	})
}
//使用道具
handler.useItem = function(msg,session,next) {
	var uid = session.get("uid")
	var itemId = msg.itemId
	if(!uid){
		next(null,{flag : false})
		return
	}
	this.app.rpc.db.bag.useItem(null,uid,itemId,function(flag,data){
		next(null,{flag : flag,data : data})
	})
}